﻿<Autocomplete TItem="Country"
                TValue="string"
                Data="@Countries"
                TextField="@(( item ) => item.Name)"
                ValueField="@(( item ) => item.Iso)"
                @bind-SelectedValue="selectedSearchValue"
                @bind-SelectedText="selectedAutoCompleteText"
                Placeholder="Search..."
                FreeTyping>
    <NotFoundContent> Sorry... @context was not found! :( </NotFoundContent>
</Autocomplete>

@code{
    [Inject]
    public CountryData CountryData { get; set; }
    public IEnumerable<Country> Countries;

    protected override async Task OnInitializedAsync()
    {
        Countries = await CountryData.GetDataAsync();
        await base.OnInitializedAsync();
    }

    [Parameter]
    public string selectedSearchValue { get; set; } = "CN";

    [Parameter]
    public string selectedAutoCompleteText { get; set; }
}